//
//  NSDate+Util.m
//  Pictorial
//
//  Created by SKY on 15/12/28.
//  Copyright © 2015年 sky. All rights reserved.
//

#import "NSDate+Util.h"

@implementation NSDate (Util)

+(NSString *)today{
    
    NSDate *today = [NSDate date];
    return [today stringFromDate];
}
+(NSString *)dateFromDay:(int)count{
    
    NSDate *today = [NSDate date];
    NSTimeInterval oneDay = 24 * 60 * 60;
    NSDate *wantDate = [today initWithTimeIntervalSinceNow:-(count * oneDay)];
    
    return [wantDate stringFromDate];
}
-(NSString *)stringFromDate{
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSString *dateString = [formatter stringFromDate:self];
    return dateString;
}
@end
